﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using System.Web.Security;

namespace BolaoDNA.WebMvc.Controllers
{
    public class TestController : Controller
    {
        public ActionResult Index()
        {
            Response.ContentType = "text/plain";
            new BolaoDNA.Repositories.NHibernate.BolaoRepository().Select();
            return Content("Rolou");
        }

        public ActionResult CriarRoleAdmin()
        {
            if (!Roles.RoleExists("Admin")) Roles.CreateRole("Admin");
            return Content("Role criado ok");
        }

        public ActionResult CriarUserAdmin()
        {
            if (Membership.GetUser("admin") == null)
            {
                Membership.CreateUser("admin", "admin!!");
                Roles.AddUserToRole("admin", "Admin");
            }
            return Content("User criado ok");
        }
    }
}
